Typical HAL DMA2D use cases for migration ¶
This section presents the typical DMA2D use cases for migration from HAL1 to HAL2.
In HAL1, to perform a DMA2D transfer, the
HAL_DMA2D_Init()
function is called first to initialize the HAL DMA2D driver and handle and configure the DMA2D peripheral with the desired transfer mode and output settings. Then,
HAL_DMA2D_ConfigLayer()
is called to configure the layer’s input settings. After configuration, the transfer is started by calling
HAL_DMA2D_Start()
or
HAL_DMA2D_Start_IT()
when transferring a single layer, or by calling
HAL_DMA2D_BlendingStart()
or
HAL_DMA2D_BlendingStart_IT()
when performing a transfer with a blending operation. Then, either call
HAL_DMA2D_PollForTransfer()
in polling mode, or if using interrupt mode, wait for the corresponding callback.
In HAL2, first initialize the driver by using
HAL_DMA2D_Init(). Then, each transfer configuration is ensured using the
dedicated transfer configuration functions
depending on the chosen transfer mode. After configuration, the transfer is initiated in all cases (transferring a single layer or transfer with blending operation) by calling
HAL_DMA2D_Start(). Finally, the application either waits for the transfer to complete by calling
HAL_DMA2D_PollForTransfer()
in polling mode, or if using interrupt mode, wait for the corresponding callback. Additional unitary APIs are introduced to manage DMA2D specific features such as
HAL_DMA2D_EnableInputAlphaInversion(),
HAL_DMA2D_EnableOutputAlphaInversion()
etc.
Key changes ¶
The DMA2D Mode parameter is removed in HAL2. New configuration APIs are introduced each tailored for a specific transfer mode.
The output ColorMode and RedBlueSwap parameters are merged into the output color_mode parameter in HAL2 as the user can directly select the chosen output color format with the red and blue swap integrated.
The output InputColorMode and RedBlueSwap parameters are merged into the input color_mode parameter in HAL2 as the user can directly select the chosen input color format with the red and blue swap integrated.
The OutputOffset and LineOffsetMode parameters are merged into the output offset parameter in HAL2.
The input and output AlphaInverted parameters are removed in HAL2. For enabling or disabling the output alpha inversion use instead HAL_DMA2D_EnableOutputAlphaInversion() and HAL_DMA2D_DisableOutputAlphaInversion(), and for enabling or disabling the input alpha inversion use instead HAL_DMA2D_EnableInputAlphaInversion() and HAL_DMA2D_DisableInputAlphaInversion().
The output BytesSwap parameter is removed in HAL2 and is being managed by HAL_DMA2D_EnableOutputByteSwap() and HAL_DMA2D_DisableOutputByteSwap() unitary functions.
In HAL2, the HAL_DMA2D_Start() function is responsible for initiating the DMA2D transfer, while the source, destination, and data size are configured separately using dedicated transfer configuration functions, unlike in HAL1.
Use case: DMA2D transfer polling mode ¶
Sequence diagram ¶
Code snippet ¶
|
HAL1 |
HAL2 |
|---|---|
const uint32_t ARGB8888_Tab[256] = { .
.
.
0xEFFFFFF2, 0xAB1FFFF0,
0x0504044E, 0x89ADCDEF,
0x15248722, 0x5201245E,
0x01025FDE, 0xFE010203,
0xEFFFFFF2, 0xAB1FFFF0,
0x0504044E, 0x89ADCDEF,
0x15248722, 0x5201245E,
0x01025FDE, 0xFE010203};
uint32_t ARGB8888_result[1024];
DMA2D_HandleTypeDef hdma2d;
/* DMA2D init configuration */
hdma2d.Instance = DMA2D;
hdma2d.Init.Mode = DMA2D_M2M;
hdma2d.Init.ColorMode = DMA2D_OUTPUT_ARGB8888;
hdma2d.Init.RedBlueSwap = DMA2D_RB_REGULAR;
hdma2d.Init.OutputOffset = 0x0;
hdma2d.Init.LineOffsetMode = DMA2D_LOM_BYTES;
hdma2d.Init.AlphaInverted = DMA2D_INVERTED_ALPHA;
hdma2d.Init.BytesSwap = DMA2D_BYTES_SWAP;
/* DMA2D layer configuration */
hdma2d.LayerCfg[DMA2D_FOREGROUND_LAYER].InputColorMode = DMA2D_INPUT_ARGB8888;
hdma2d.LayerCfg[DMA2D_FOREGROUND_LAYER].RedBlueSwap = DMA2D_RB_REGULAR;
hdma2d.LayerCfg[DMA2D_FOREGROUND_LAYER].InputOffset = 0;
hdma2d.LayerCfg[DMA2D_FOREGROUND_LAYER].AlphaMode = DMA2D_REPLACE_ALPHA;
hdma2d.LayerCfg[DMA2D_FOREGROUND_LAYER].InputAlpha = 0xFF;
hdma2d.LayerCfg[DMA2D_FOREGROUND_LAYER].AlphaInverted = DMA2D_INVERTED_ALPHA;
HAL_DMA2D_Init(&hdma2d);
HAL_DMA2D_ConfigLayer(&hdma2d, DMA2D_FOREGROUND_LAYER);
HAL_DMA2D_Start(&hdma2d, (uint32_t)&ARGB8888_Tab,
(uint32_t)&ARGB8888_result, 16, 16);
HAL_DMA2D_PollForTransfer(&hdma2d, 10);
|
const uint32_t ARGB8888_Tab[256] = { .
.
.
0xEFFFFFF2, 0xAB1FFFF0,
0x0504044E, 0x89ADCDEF,
0x15248722, 0x5201245E,
0x01025FDE, 0xFE010203,
0xEFFFFFF2, 0xAB1FFFF0,
0x0504044E, 0x89ADCDEF,
0x15248722, 0x5201245E,
0x01025FDE, 0xFE010203};
uint32_t ARGB8888_result[1024];
hal_dma2d_handle_t hdma2d;
/* DMA2D initialization */
HAL_DMA2D_Init(&hdma2d, HAL_DMA2D);
/* DMA2D output configuration */
p_config.output.p_dest = (void *)&ARGB8888_result;
p_config.output.color_mode = HAL_DMA2D_OUTPUT_COLOR_ARGB8888;
p_config.output.offset = 0x0;
/* DMA2D input configuration */
p_config.input.p_src = (void const*) (uint32_t)&ARGB8888_Tab;
p_config.input.color_mode = HAL_DMA2D_INPUT_COLOR_ARGB8888;
p_config.input.offset = 0;
p_config.input.alpha_mode = HAL_DMA2D_INPUT_ALPHA_REPLACE;
p_config.input.alpha_value = 0xFF;
p_config.width = 16;
p_config.height = 16;
HAL_DMA2D_EnableOutputAlphaInversion(&hdma2d);
HAL_DMA2D_EnableOutputByteSwap(&hdma2d);
HAL_DMA2D_EnableInputAlphaInversion(&hdma2d);
HAL_DMA2D_SetConfigMemCopy(&hdma2d, &p_config);
HAL_DMA2D_Start(&hdma2d);
HAL_DMA2D_PollForTransfer(&hdma2d, 10);
|
Key changes ¶
In HAL2, the source, destination, and size are configured using a dedicated configuration function (for example,
HAL_DMA2D_SetConfigMemCopy()) before callingHAL_DMA2D_Start().HAL2 introduces unitary APIs to enable specific features (for example, alpha inversion and byte swap).
Use case: DMA2D transfer blending polling mode ¶
Sequence diagram ¶
Code snippet ¶
|
HAL1 |
HAL2 |
|---|---|
DMA2D_HandleTypeDef hdma2d;
/* DMA2D init configuration */
hdma2d.Instance = DMA2D;
hdma2d.Init.Mode = DMA2D_M2M_BLEND;
hdma2d.Init.ColorMode = DMA2D_OUTPUT_ARGB8888;
hdma2d.Init.RedBlueSwap = DMA2D_RB_REGULAR;
hdma2d.Init.OutputOffset = 0x0;
hdma2d.Init.AlphaInverted = DMA2D_REGULAR_ALPHA;
hdma2d.Init.BytesSwap = DMA2D_BYTES_REGULAR;
/* Foreground Configuration */
hdma2d.LayerCfg[1].AlphaMode = DMA2D_REPLACE_ALPHA;
hdma2d.LayerCfg[1].InputAlpha = 0xFF;
hdma2d.LayerCfg[1].InputColorMode = DMA2D_INPUT_RGB565;
hdma2d.LayerCfg[1].InputOffset = 0x0;
hdma2d.LayerCfg[1].RedBlueSwap = DMA2D_RB_REGULAR;
hdma2d.LayerCfg[1].AlphaInverted = DMA2D_REGULAR_ALPHA;
/* Background Configuration */
hdma2d.LayerCfg[0].AlphaMode = DMA2D_REPLACE_ALPHA;
hdma2d.LayerCfg[0].InputAlpha = 0xFF;
hdma2d.LayerCfg[0].InputColorMode = DMA2D_INPUT_RGB565;
hdma2d.LayerCfg[0].InputOffset = 0x0;
hdma2d.LayerCfg[0].RedBlueSwap = DMA2D_RB_REGULAR;
hdma2d.LayerCfg[0].AlphaInverted = DMA2D_REGULAR_ALPHA;
HAL_DMA2D_Init(&hdma2d);
HAL_DMA2D_ConfigLayer(&hdma2d, 0);
HAL_DMA2D_ConfigLayer(&hdma2d, 1);
HAL_DMA2D_BlendingStart(&hdma2d, (uint32_t)&RGB565_64x80_1,
(uint32_t)&RGB565_64x80_2,LCD_FRAME_BUFFER, 64, 80);
HAL_DMA2D_PollForTransfer(&hdma2d, 10);
|
hal_dma2d_handle_t hdma2d;
/* DMA2D initialization */
HAL_DMA2D_Init(&hdma2d, HAL_DMA2D);
/* DMA2D output configuration */
p_config.output.p_dest = (void *) OUTPUT_FRAME_BUFFER;
p_config.output.color_mode = HAL_DMA2D_OUTPUT_COLOR_ARGB8888;
p_config.output.offset = 0x0;
/* Foreground Configuration */
p_config.fg_input.p_src = (void const*) (uint32_t)&RGB565_64x80_1;
p_config.fg_input.alpha_mode = HAL_DMA2D_INPUT_ALPHA_REPLACE;
p_config.fg_input.alpha_value = 0xFF;
p_config.fg_input.color_mode = HAL_DMA2D_INPUT_COLOR_RGB565;
p_config.fg_input.offset = 0;
/* Background Configuration */
p_config.bg_input.p_src = (void const*) (uint32_t)&RGB565_64x80_2;
p_config.bg_input.alpha_mode = HAL_DMA2D_INPUT_ALPHA_REPLACE;
p_config.bg_input.alpha_value = 0xFF;
p_config.bg_input.color_mode = HAL_DMA2D_INPUT_COLOR_RGB565;
p_config.bg_input.offset = 0;
p_config.width = 64;
p_config.height = 80;
HAL_DMA2D_SetConfigBlending(&hdma2d, &p_config);
HAL_DMA2D_Start(&hdma2d);
HAL_DMA2D_PollForTransfer(&hdma2d, 10);
|
Key changes ¶
In HAL2, blending transfers are configured using
HAL_DMA2D_SetConfigBlending()and started usingHAL_DMA2D_Start().In HAL1, blending uses a dedicated start API (
HAL_DMA2D_BlendingStart()) after layer configuration.
Use case: DMA2D transfer interrupt mode ¶
Sequence diagram ¶
Code snippet ¶
|
HAL1 |
HAL2 |
|---|---|
const uint32_t RGB888_Tab[256] = { .
.
.};
uint32_t RGB888_result[1024];
DMA2D_HandleTypeDef hdma2d;
/* DMA2D init configuration */
hdma2d.Instance = DMA2D;
hdma2d.Init.Mode = DMA2D_M2M_PFC;
hdma2d.Init.ColorMode = DMA2D_OUTPUT_RGB888;
hdma2d.Init.RedBlueSwap = DMA2D_RB_REGULAR;
hdma2d.Init.OutputOffset = 0x0;
hdma2d.Init.AlphaInverted = DMA2D_REGULAR_ALPHA;
hdma2d.Init.BytesSwap = DMA2D_BYTES_SWAP;
hdma2d.XferCpltCallback = HAL_DMA2D_CL_TransferCpltCallback;
hdma2d.XferErrorCallback = HAL_DMA2D_CL_XferErrorCallback;
/* DMA2D layer configuration */
hdma2d.LayerCfg[DMA2D_FOREGROUND_LAYER].InputColorMode = DMA2D_INPUT_ARGB4444;
hdma2d.LayerCfg[DMA2D_FOREGROUND_LAYER].RedBlueSwap = DMA2D_RB_REGULAR;
hdma2d.LayerCfg[DMA2D_FOREGROUND_LAYER].InputOffset = 0;
hdma2d.LayerCfg[DMA2D_FOREGROUND_LAYER].AlphaMode = DMA2D_NO_MODIF_ALPHA;
hdma2d.LayerCfg[DMA2D_FOREGROUND_LAYER].InputAlpha = 0xFF;
hdma2d.LayerCfg[DMA2D_FOREGROUND_LAYER].AlphaInverted = DMA2D_REGULAR_ALPHA;
HAL_DMA2D_Init(&hdma2d);
HAL_DMA2D_ConfigLayer(&hdma2d, DMA2D_FOREGROUND_LAYER);
HAL_DMA2D_Start_IT(&hdma2d, (uint32_t)&RGB888_Tab,
(uint32_t)&RGB888_result, 130, 120);
|
const uint32_t RGB888_Tab[256] = { .
.
.};
uint32_t RGB888_result[1024];
hal_dma2d_handle_t hdma2d;
/* DMA2D initialization */
HAL_DMA2D_Init(&hdma2d, HAL_DMA2D);
/* DMA2D output configuration */
p_config.output.p_dest = (void *)&RGB888_result;
p_config.output.color_mode = HAL_DMA2D_OUTPUT_COLOR_RGB888;
p_config.output.offset = 0x0;
/* DMA2D input configuration */
p_config.input.p_src = (void const*) (uint32_t)&RGB888_Tab;
p_config.input.color_mode = HAL_DMA2D_INPUT_COLOR_ARGB4444;
p_config.input.offset = 0;
p_config.input.alpha_mode = HAL_DMA2D_INPUT_ALPHA_NO_MODIF;
p_config.input.alpha_value = 0xFF;
p_config.width = 130;
p_config.height = 120;
HAL_DMA2D_RegisterXferCpltCallback(&hdma2d, HAL_DMA2D_TransferComplete);
HAL_DMA2D_RegisterErrorCallback(&hdma2d, HAL_DMA2D_TransferError);
HAL_DMA2D_SetConfigMemCopyPFC(&hdma2d, &p_config);
HAL_DMA2D_Start_IT(&hdma2d);
|
Key changes ¶
In HAL2, transfer configuration is performed with a dedicated function (for example,
HAL_DMA2D_SetConfigMemCopyPFC()) before starting the transfer.HAL2 provides dedicated registration APIs for the transfer-complete and error callbacks.
Use case: DMA2D transfer blending interrupt mode ¶
Sequence diagram ¶
Code snippet ¶
|
HAL1 |
HAL2 |
|---|---|
DMA2D_HandleTypeDef hdma2d;
/* DMA2D init configuration */
hdma2d.Instance = DMA2D;
hdma2d.Init.Mode = DMA2D_M2M_BLEND;
hdma2d.Init.ColorMode = DMA2D_OUTPUT_ARGB8888;
hdma2d.Init.RedBlueSwap = DMA2D_RB_REGULAR;
hdma2d.Init.OutputOffset = 0x0;
hdma2d.Init.AlphaInverted = DMA2D_REGULAR_ALPHA;
hdma2d.Init.BytesSwap = DMA2D_BYTES_REGULAR;
hdma2d.XferCpltCallback = HAL_DMA2D_CL_TransferCpltCallback;
hdma2d.XferErrorCallback = HAL_DMA2D_CL_XferErrorCallback;
/* Foreground Configuration */
hdma2d.LayerCfg[1].AlphaMode = DMA2D_REPLACE_ALPHA;
hdma2d.LayerCfg[1].InputAlpha = 0xFF;
hdma2d.LayerCfg[1].InputColorMode = DMA2D_INPUT_RGB565;
hdma2d.LayerCfg[1].InputOffset = 0x0;
hdma2d.LayerCfg[1].RedBlueSwap = DMA2D_RB_REGULAR;
hdma2d.LayerCfg[1].AlphaInverted = DMA2D_REGULAR_ALPHA;
/* Background Configuration */
hdma2d.LayerCfg[0].AlphaMode = DMA2D_REPLACE_ALPHA;
hdma2d.LayerCfg[0].InputAlpha = 0xFF;
hdma2d.LayerCfg[0].InputColorMode = DMA2D_INPUT_RGB565;
hdma2d.LayerCfg[0].InputOffset = 0x0;
hdma2d.LayerCfg[0].RedBlueSwap = DMA2D_RB_REGULAR;
hdma2d.LayerCfg[0].AlphaInverted = DMA2D_REGULAR_ALPHA;
HAL_DMA2D_Init(&hdma2d);
HAL_DMA2D_ConfigLayer(&hdma2d, 0);
HAL_DMA2D_ConfigLayer(&hdma2d, 1);
HAL_DMA2D_BlendingStart_IT(&hdma2d, (uint32_t)&RGB565_64x80_1,
(uint32_t)&RGB565_64x80_2,LCD_FRAME_BUFFER, 64, 80);
|
hal_dma2d_handle_t hdma2d;
/* DMA2D initialization */
HAL_DMA2D_Init(&hdma2d, HAL_DMA2D);
/* DMA2D output configuration */
p_config.output.p_dest = (void *) OUTPUT_FRAME_BUFFER;
p_config.output.color_mode = HAL_DMA2D_OUTPUT_COLOR_ARGB8888;
p_config.output.offset = 0x0;
/* Foreground Configuration */
p_config.fg_input.p_src = (void const*) (uint32_t)&RGB565_64x80_1;
p_config.fg_input.alpha_mode = HAL_DMA2D_INPUT_ALPHA_REPLACE;
p_config.fg_input.alpha_value = 0xFF;
p_config.fg_input.color_mode = HAL_DMA2D_INPUT_COLOR_RGB565;
p_config.fg_input.offset = 0;
/* Background Configuration */
p_config.bg_input.p_src = (void const*) (uint32_t)&RGB565_64x80_2;
p_config.bg_input.alpha_mode = HAL_DMA2D_INPUT_ALPHA_REPLACE;
p_config.bg_input.alpha_value = 0xFF;
p_config.bg_input.color_mode = HAL_DMA2D_INPUT_COLOR_RGB565;
p_config.bg_input.offset = 0;
p_config.width = 64;
p_config.height = 80;
HAL_DMA2D_RegisterXferCpltCallback(&hdma2d, HAL_DMA2D_TransferComplete);
HAL_DMA2D_RegisterErrorCallback(&hdma2d, HAL_DMA2D_TransferError);
HAL_DMA2D_SetConfigBlending(&hdma2d, &p_config);
HAL_DMA2D_Start_IT(&hdma2d);
|
Key changes ¶
In HAL2, blending transfers are configured using
HAL_DMA2D_SetConfigBlending()and started usingHAL_DMA2D_Start_IT().HAL2 provides dedicated registration APIs for the transfer-complete and error callbacks.
Use case: DMA2D CLUT loading in polling mode ¶
In HAL1, there are two ways for loading the CLUT:
Either use
HAL_DMA2D_CLUTStartLoad()in polling mode orHAL_DMA2D_CLUTStartLoad_IT()in interrupt mode followed byHAL_DMA2D_PollForTransfer()to wait for the completion of the CLUT loading.Alternatively, use
HAL_DMA2D_CLUTLoad(), orHAL_DMA2D_ConfigCLUT()followed byHAL_DMA2D_EnableCLUT()in polling mode. If using interrupt mode, useHAL_DMA2D_CLUTLoad_IT(). Then,HAL_DMA2D_PollForTransfer()should be called to wait for the completion of the CLUT loading. Note that this option is considered obsolete in HAL1 itself.
In HAL2, the CLUT transfer configuration is managed by
HAL_DMA2D_StartCLUTLoad()
in polling mode, or
HAL_DMA2D_StartCLUTLoad_IT()
if using interrupt mode. Furthermore, the polling function is split:
HAL_DMA2D_PollForCLUTLoad()
to wait for the CLUT loading completion and
HAL_DMA2D_PollForTransfer()
to wait for the completion of standard data loading.
Sequence diagram ¶
Code snippet ¶
|
HAL1 |
HAL2 |
|---|---|
const uint32_t ARGB8888_Tab[256] = { .
.
.
0xEFFFFFF2, 0xAB1FFFF0,
0x0504044E, 0x89ADCDEF,
0x15248722, 0x5201245E,
0x01025FDE, 0xFE010203,
0xEFFFFFF2, 0xAB1FFFF0,
0x0504044E, 0x89ADCDEF,
0x15248722, 0x5201245E,
0x01025FDE, 0xFE010203};
uint32_t CLUT_8[256] = { .
.
.
0xC0C0, 0x20C0C0, 0x40C0C0,
0x60C0C0, 0x80C0C0, 0xA0C0C0,
0xFFFBF0, 0xA0A0A4, 0x808080,
0xFF0000, 0xFF00, 0xFFFF00,
0xFF, 0xFF00FF, 0xFFFF, 0xFFFFFF};
uint32_t L8_result[1024];
DMA2D_HandleTypeDef hdma2d;
DMA2D_CLUTCfgTypeDef CLUTCfg;
hdma2d.Instance = DMA2D;
hdma2d.Init.Mode = DMA2D_M2M_PFC;
hdma2d.Init.ColorMode = DMA2D_OUTPUT_ARGB8888;
hdma2d.Init.OutputOffset = 0x0;
hdma2d.Init.AlphaInverted = DMA2D_REGULAR_ALPHA;
hdma2d.Init.RedBlueSwap = DMA2D_RB_REGULAR;
hdma2d.Init.BytesSwap = DMA2D_BYTES_REGULAR;
hdma2d.Init.LineOffsetMode = DMA2D_LOM_BYTES;
hdma2d.LayerCfg[DMA2D_FOREGROUND_LAYER].InputColorMode = DMA2D_INPUT_AL88;
hdma2d.LayerCfg[DMA2D_FOREGROUND_LAYER].InputOffset = 0;
hdma2d.LayerCfg[DMA2D_FOREGROUND_LAYER].AlphaMode = DMA2D_NO_MODIF_ALPHA;
hdma2d.LayerCfg[DMA2D_FOREGROUND_LAYER].InputAlpha = 0xFF;
hdma2d.LayerCfg[DMA2D_FOREGROUND_LAYER].AlphaInverted = DMA2D_REGULAR_ALPHA;
hdma2d.LayerCfg[DMA2D_FOREGROUND_LAYER].RedBlueSwap = DMA2D_RB_REGULAR;
CLUTCfg.pCLUT = (uint32_t *)CLUT_8;
CLUTCfg.CLUTColorMode = DMA2D_CCM_ARGB8888;
CLUTCfg.Size = 255;
HAL_DMA2D_Init(&hdma2d);
HAL_DMA2D_ConfigCLUT(&hdma2d, CLUTCfg, DMA2D_FOREGROUND_LAYER);
HAL_DMA2D_EnableCLUT(&hdma2d, DMA2D_FOREGROUND_LAYER);
HAL_DMA2D_PollForTransfer(&hdma2d, 10);
|
const uint32_t ARGB8888_Tab[256] = { .
.
.
0xEFFFFFF2, 0xAB1FFFF0,
0x0504044E, 0x89ADCDEF,
0x15248722, 0x5201245E,
0x01025FDE, 0xFE010203,
0xEFFFFFF2, 0xAB1FFFF0,
0x0504044E, 0x89ADCDEF,
0x15248722, 0x5201245E,
0x01025FDE, 0xFE010203};
uint32_t CLUT_8[256] = { .
.
.
0xC0C0, 0x20C0C0, 0x40C0C0,
0x60C0C0, 0x80C0C0, 0xA0C0C0,
0xFFFBF0, 0xA0A0A4, 0x808080,
0xFF0000, 0xFF00, 0xFFFF00,
0xFF, 0xFF00FF, 0xFFFF, 0xFFFFFF};
uint32_t L8_result[1024];
hal_dma2d_handle_t hdma2d;
hal_dma2d_clut_config_t p_clut_conf;
hal_dma2d_mem_copy_config_t p_config;
p_config.output.p_dest = (void const*) (uint32_t)&L8_result;
p_config.output.color_mode = HAL_DMA2D_OUTPUT_COLOR_ARGB8888;
p_config.output.offset = 0x0;
p_config.input.p_src = (void const*) (uint32_t)&ARGB8888_Tab;
p_config.input.color_mode = HAL_DMA2D_INPUT_COLOR_AL88;
p_config.input.offset = 0;
p_config.input.alpha_mode = HAL_DMA2D_INPUT_ALPHA_NO_MODIF;
p_config.input.alpha_value = 0xFF;
p_config.width = 16;
p_config.height = 32;
p_clut_conf.p_clut = (uint32_t *)CLUT_8;
p_clut_conf.color_mode = HAL_DMA2D_CLUT_COLOR_ARGB8888;
p_clut_conf.size = 255;
HAL_DMA2D_Init(&hdma2d, HAL_DMA2D);
HAL_DMA2D_StartCLUTLoad(&hdma2d, &p_clut_conf, HAL_DMA2D_INPUT_FG);
HAL_DMA2D_PollForCLUTLoad(&hdma2d, HAL_DMA2D_INPUT_FG, 10);
|
Note
The DMA2D CLUT loading use case in interrupt mode is similar to the polling-mode use case; the function calls are simply replaced with their interrupt-mode counterparts.
For example instead of using HAL_DMA2D_StartCLUTLoad() in polling mode, use HAL_DMA2D_StartCLUTLoad_IT() in interrupt mode.
Key changes ¶
In HAL2, CLUT loading is configured and started using
HAL_DMA2D_StartCLUTLoad(), and the completion is polled usingHAL_DMA2D_PollForCLUTLoad().In HAL2,
HAL_DMA2D_PollForTransfer()is used to poll standard data transfers (not CLUT loading).









